﻿using System;
using System.Collections.Generic;
using System.Text;
using AgilePlannerDT.Data;

namespace AgilePlannerDT.Application.Commands.Impl
{
    public class IterationCreateCommand : ApCommandImpl
    {
        Iteration after;

        public IterationCreateCommand(AgilePlannerApplication app, Iteration after)
            : base(app)
        {
            this.after = after;
        }

        public override void Undo()
        {
            if (!isUndone)
            {
                base.Undo();
                app.Persister.DeleteIteration(after.ID);
            }
        }

        public override void Redo()
        {
            if (IsUndone)
            {
                base.Redo();

                app.Persister.UndeleteIteration(after);
            }
        }
    }
}
